package com.weigee.ktv.v.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.l.d.app.library.util.ToastUtil;
import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
import com.weigee.ktv.R;
import com.weigee.ktv.v.view.SafetySettingsItemView;
import com.weigee.ktv.v.view.WrapTitleBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by linde on 2017/04/27.
 * <p/>
 */
public class SafetySettingsFragment extends BaseFragment2 {

    @BindView(R.id.wrap_title_bar)
    WrapTitleBar wrapTitleBar;
    @BindView(R.id.edit_paying_psd)
    SafetySettingsItemView editPayingPsd;
    @BindView(R.id.find_paying_psd)
    SafetySettingsItemView findPayingPsd;
    @BindView(R.id.t_refresh)
    TwinklingRefreshLayout tRefresh;
    Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.safetysettings_frag, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        wrapTitleBar.setTitle("安全设置");
        wrapTitleBar.setLeftButton(View.VISIBLE, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                back();
            }
        });

        tRefresh.setEnableRefresh(false);
        tRefresh.setEnableLoadmore(false);
//        ListUtil.initTwinklingRefresh(m_tRefresh, new RefreshListenerAdapter() {
//            @Override
//            public void onRefresh(TwinklingRefreshLayout refreshLayout) {
//                super.onRefresh(refreshLayout);
//                m_tRefresh.finishRefreshing();
//            }
//
//            @Override
//            public void onLoadMore(TwinklingRefreshLayout refreshLayout) {
//                super.onLoadMore(refreshLayout);
//                m_tRefresh.finishLoadmore();
//            }
//        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.edit_paying_psd, R.id.find_paying_psd})
    public void onViewClicked(View view) {
        final Context context = view.getContext();
        switch (view.getId()) {
            case R.id.edit_paying_psd:
                ToastUtil.makeTest(context, "修改支付密码");
                break;
            case R.id.find_paying_psd:
                ToastUtil.makeTest(context, "找回支付密码");
                break;
        }
    }
}
